package org.example.demo7;/*
 *@ 代阳敲的专属代码
 **/

import java.util.ArrayList;
import java.util.List;

public class Dog {
    private   String name;
    private  String age;

    public Dog(String name, String age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Dog{" +
                "name='" + name + '\'' +
                ", age='" + age + '\'' +
                '}';
    }
}
class cat {}
class Main {
    public static void main(String[] args) {
        //List list=new ArrayList();
       // List <Object>list=new ArrayList<>();
        List <Dog>list= new  ArrayList<Dog>();
        list.add(new Dog("小花","11"));
        list.add(new Dog("小绿","12"));
        list.add(new Dog("小黑","13"));
        //list.add(new cat());
        for (Object o: list) {
            Dog dog=(Dog) o;
            System.out.println(dog);
        }
    }
}